<!--
 * @Version: 1.0
 * @Date: 2021-01-23 09:29:50
 * @LastEditTime: 2021-08-17 11:09:35
 * @Description:
-->
<template>
  <div v-loading="loading" class="app-container">
    <el-tabs v-model="activeName">
      <el-tab-pane v-for="item in tabs" :key="item.id" :label="item.name" :name="item.component">
        <component :is="components[item.component]" />
      </el-tab-pane>
    </el-tabs>
  </div>
</template>

<script>
import cacheList from '@/layout/mixin/cacheList'
export default {
  name: 'SystemConfig',
  mixins: [cacheList],
  data() {
    return {
      loading: false,
      componentName: 'SystemConfig',
      tabs: [],
      activeName: '',
      components: {
        'upload': () => import('./component/upload'),
        'basic': () => import('./component/basic'), // 基本配置
        'product': () => import('./component/product'), // 商品配置
        'defaultContract': () => import('./component/defaultContract'), // 默认合同
        'fbaAllotOrderConfig': () => import('./component/fbaAllotOrderConfig'), // fba 调拨单 系统配置参数
        'orders': () => import('./component/orders')
      }
    }
  },
  created() {
    this.loading = true
    this.$http.get('config/parent').then(response => {
      this.tabs = response.data
      this.activeName = this.tabs[0].component
      this.loading = false
    }).catch(() => {
      this.loading = false
    })
  }
}
</script>

<style scoped>
</style>
